{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a3bb018b-6de3-4b28-aca5-fb3043c4fbf1",
   "metadata": {
    "tags": [
     "remove_cell"
    ]
   },
   "outputs": [],
   "source": [
    "import datapane as dp"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "72013dca-0427-4fc6-842e-f495beceab7b",
   "metadata": {},
   "source": [
    "::: datapane.Media\n",
    "\n",
    "### Simple image embed\n",
    "\n",
    "In the following example, Datapane will display images in your app for viewers and allow users to download them."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0f025658-d0f5-4396-bce8-b96f7fe6a889",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "dp.Media(file=\"./image.png\", name=\"Image1\", caption=\"Datapane in action!\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1cf6187b-3e42-44a5-b221-dc3d199ce54d",
   "metadata": {
    "tags": []
   },
   "source": [
    "::: datapane.Embed"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "99b9b745-79c0-4a2d-9c61-1464487e76ac",
   "metadata": {},
   "source": [
    "### Simple YouTube embed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4e6cbd5d-2e0a-4c7e-9a99-2c403ab4fb7d",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "dp.Embed(url='https://www.youtube.com/watch?v=_KS_yZBI71s&t')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aea6aaca-1922-45fc-8b90-f5678196250d",
   "metadata": {},
   "source": [
    "You don't need to use this block for simple embeds, e.g. GIFs. For those, just use Markdown syntax i.e. `![](https://my-example-gif.gif)`"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "73f442ed-fbe1-4095-a5e8-751f26ad0516",
   "metadata": {},
   "source": [
    "::: datapane.Attachment"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a6b4631f-d5f5-4586-a32f-7d097fb429c6",
   "metadata": {},
   "source": [
    "### Simple attachment"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1591d530-519c-43ff-9473-7020f6c78250",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "data_path = \"./netflix_stock_data.csv\"\n",
    "\n",
    "dp.Attachment(file=data_path)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8518ed89-0b49-4a0f-92a5-0508061b00f8",
   "metadata": {},
   "source": [
    "### Python object attachment"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ae96cd80-54c8-4a3e-a73e-ea6b40f78ea9",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "vehicle_dict = {\"brand\": \"Ford\", \"model\": \"Mustang\", \"year\": 1964}\n",
    "\n",
    "dp.Attachment(vehicle_dict, name=\"vehicle_dict\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3a70bb2b-6587-41f6-a1cc-219c93952717",
   "metadata": {},
   "source": [
    "### Multiple attachments"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4ba263ec-42a1-4359-b0fe-1c20acb51c42",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "data_path = \"./netflix_stock_data.csv\"\n",
    "\n",
    "vehicle_dict = {\"brand\": \"Ford\", \"model\": \"Mustang\", \"year\": 1964}\n",
    "\n",
    "dp.Group(\n",
    "    dp.Attachment(file=data_path), dp.Attachment(vehicle_dict, name=\"vehicle_dict\")\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
